using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ras2ClassLib;

public partial class DisplayList : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!this.IsPostBack)
		{
			FillList("");
		}
	}

	protected void OnGridViewPageIndexChanging(object sender, GridViewPageEventArgs e)
	{
		m_GridViewListFaersla.PageIndex = e.NewPageIndex;
		FillList(Convert.ToString(this.ViewState["SortColumn"]));
	}

	protected void OnGridViewSorting(object sender, GridViewSortEventArgs e)
	{
		FillList(e.SortExpression);
	}

	protected void FillList(String strOrderBy)
	{
		String strID = Request.QueryString["ID"];
		if (!String.IsNullOrEmpty(strID))
		{
			this.ViewState["ListaID"] = strID;
		}
		
		VinListFaerslaDoc doc = new VinListFaerslaDoc();
        VinListFaerslaCollection listi = doc.GetAllVinListFaersla(Convert.ToInt32(strID));

	if ( listi != null )
		{
			if (!String.IsNullOrEmpty(strOrderBy))
			{
				listi.Sort(strOrderBy);
				this.ViewState[ "SortColumn" ] = strOrderBy;
			}
	
			m_GridViewListFaersla.DataSource = listi;
			m_GridViewListFaersla.DataBind();
		}
	}
}

